package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 用户数据层接口
 */
@Mapper
public interface UserMapper {

    /**
     * 通过当前的 openId 获取当前用户
     * @return
     */
    @Select("select * from user where openid = #{openId}")
    User selectUserByOpenId(String openId);

    /**
     * 注册用户
     * @param user
     */
    void insertUser(User user);

    /**
     * 通过用户ID获取当前用户信息
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);
}
